﻿@model CMSApplication.Areas.Administration.Models.UserModel
@{ 
    ViewBag.Title = "TM Nhan vien";
}
<script>
    jQuery(document).ready(function () {
        jQuery("#UserForm").submit(function () {
            jQuery.post(jQuery(this).attr("action"), jQuery("#UserForm").serialize(), function (returnObj) {
                if (returnObj.Status == "success") {
                    if (returnObj.Message != null) {
                        $.pnotify({
                            title: 'Success',
                            text: returnObj.Message,
                            type: 'info',
                            opacity: .8
                        });
                        $("form input:text").val('');
                        $("form input:password").val('');
                        $("form textarea").val('');
                    }
                    else if (returnObj.RedirectUrl != null) {
                        window.location.href = returnObj.RedirectUrl;
                    }
                } else {
                    $.pnotify({
                        title: 'Lỗi',
                        text: returnObj.Message,
                        type: 'error',
                        opacity: .8
                    });
                }
            });
            return false;
        });
    });
</script>

<div class="row-fluid">
    <div class="span12">
        <div class="head">
            <div class="isw-documents"></div>
            <h1>Thêm mới nhân viên</h1>
            <div class="clear"></div>
        </div>
        <div class="block-fluid">
             @using (Html.BeginForm("AddUser", "UserManagement", FormMethod.Post, new { enctype = "multipart/form-data", @id="UserForm" }))
             {
                <div class="warning-area"></div>
                <div class="row-form">
                    <div class="span2">Loại</div>
                    <div class="span10">@Html.DropDownList("rolesId", "- - Chọn - -")</div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">CMND</div>
                    <div class="span10">
                        @Html.TextBoxFor(model => Model.CompanyName, new { })
                        @Html.ValidationMessageFor(model => model.CompanyName)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Họ & Tên</div>
                    <div class="span10">
                        @Html.TextBoxFor(model => Model.FullName, new { })
                        @Html.ValidationMessageFor(model => model.FullName)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Địa chỉ</div>
                    <div class="span10">
                        @Html.TextBoxFor(model => Model.Address, new { })
                        @Html.ValidationMessageFor(model => model.Address)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Điện thoại</div>
                    <div class="span10">
                        @Html.TextBoxFor(m => m.Phone, new { })
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Email</div>
                    <div class="span10">
                        @Html.TextBoxFor(model => Model.Email, new { })
                        @Html.ValidationMessageFor(model => model.Email)
                    </div>
                    <div class="clear"></div>
                </div>
                <!--
                <div class="row-form">
                    <div class="span2">Hình ảnh</div>
                    <div class="span10"><input type="file" name="FileUp" /></div>
                    <div class="clear"></div>
                </div>-->
                <div class="row-form">
                    <div class="span2">Tài khoản</div>
                    <div class="span10">
                        @Html.TextBoxFor(model => Model.UserName, new { })
                        @Html.ValidationMessageFor(model => model.UserName)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Mật khẩu</div>
                    <div class="span10">
                        @Html.PasswordFor(model => Model.Password, new { })
                        @Html.ValidationMessageFor(model => model.Password)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Ghi chú</div>
                    <div class="span10">
                        @Html.TextAreaFor(model => Model.Description, new { @style = "height:150px" })
                        @Html.ValidationMessageFor(model => model.Description)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2">Trạng thái</div>
                    <div class="span10">
                        @Html.EditorFor(model => Model.Status)
                        @Html.ValidationMessageFor(model => model.Status)
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="row-form">
                    <div class="span2"></div>
                    <div class="span10">
                        <input type="submit" name="save" value="Lưu lại" class="btn" />
                    </div>
                    <div class="clear"></div>
                </div>
             }
        </div>
    </div>
</div>
